<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>splice</title>
</head>
<body>
<script>
    var arr1 = ["a", "b", "c", "d", "e", "f"];
    var result1 = arr1.splice(1); //从第index为1的位置开始，删除元素

    console.log("arr1：" + JSON.stringify(arr1));
    console.log("result1：" + JSON.stringify(result1));
    console.log("-----------------------");

    var arr2 = ["a", "b", "c", "d", "e", "f"];
    var result2 = arr2.splice(-2); //从第一个位置开始，删除元素

    console.log("arr2：" + JSON.stringify(arr2));
    console.log("result2：" + JSON.stringify(result2));
    console.log("-----------------------");

    var arr3 = ["a", "b", "c", "d", "e", "f"];
    var result3 = arr3.splice(1, 3); //从第index为1的位置开始删除元素,一共删除三个元素

    console.log("arr3：" + JSON.stringify(arr3));
    console.log("result3：" + JSON.stringify(result3));
    console.log("-----------------------");
</script>
</body>
</html>